package testUnit;

import static org.junit.Assert.*;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import FamilyTherapy.EventCard;
import FamilyTherapy.MagicToolCard;

public class testMagicToolCard {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testMagicToolCard() {
		boolean isNEW=false;
		MagicToolCard m = new MagicToolCard();
		
		if(m != null)
			isNEW=true;
		assertEquals(true,isNEW);
	}

	@Test
	public void testNoDeduction() 
	{
		final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outContent));
		
		
		//if (newLine == null) newLine = "\n";
		
		MagicToolCard m = new MagicToolCard();		
		int result = m.noDeduction();
		
		String expected = "Now, you use noDeduction card so that no SE point will not be deducted.\n";
		
		assertEquals(expected,outContent.toString());
		assertEquals(result, -1);
		
	}

	@Test
	public void testNoDeuctionAsFeeling() 
	{
		final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outContent));
		
		
		//if (newLine == null) newLine = "\n";
		
		MagicToolCard m = new MagicToolCard();		
		int result = m.noDeuctionAsFeeling();
		
		String expected = "Now, you use noDeuctionAsFeeling card.\n" +
						 "Please show your feeling so that no SE point will not be deducted.\n" ;
		
		assertEquals(expected,outContent.toString());
		assertEquals(result, -1);
	}

}
